// function sum(m, n) {
//   return m + n;
// }
// console.log(`sum(1, 2)`, sum(1, 2));

// 柯理化函数 柯里化
// function sum(m) {
//   return function (n) {
//     return m + n;
//   };
// }
// console.log(`sum(1)(2)`, sum(1)(2));
// console.log(`sum(4)(6)`, sum(4)(6));

// var add10 = sum(10); //复用一部分代码
// console.log(`add10(20)`, add10(20));
// console.log(`add10(30)`, add10(30));

function log(data, type, msg) {
  console.log(`[${data.getHours()}:${data.getMinutes()}][${type}]:[${msg}]`);
}
log(new Date(), "info", "这是一条info日志");
log(new Date(), "error", "这是一条error日志");

var kllog = (data) => (type) => (msg) =>
  `[${data.getHours()}:${data.getMinutes()}][${type}]:[${msg}]`;

var nowInfoLog = kllog(new Date())("info");
console.log(`nowInfoLog("这是一条info日志");`, nowInfoLog("这是一条info日志"));
console.log(`nowInfoLog("这是一条info日志")`, nowInfoLog("这是一条info日志"));
console.log(`nowInfoLog("这是一条info日志")`, nowInfoLog("这是一条info日志"));
console.log(`nowInfoLog("这是一条info日志")`, nowInfoLog("这是一条info日志"));
